home *** CD-ROM | disk | FTP | other *** search
- VERSION 4.00
- Begin VB.Form APFForm
- Caption = "Show APF"
- ClientHeight = 3135
- ClientLeft = 2415
- ClientTop = 1650
- ClientWidth = 3135
- Height = 3825
- Left = 2355
- LinkTopic = "Form1"
- ScaleHeight = 3135
- ScaleWidth = 3135
- Top = 1020
- Width = 3255
- Begin VB.PictureBox Canvas
- Height = 3135
- Left = 0
- ScaleHeight = 3075
- ScaleWidth = 3075
- TabIndex = 0
- Top = 0
- Width = 3135
- End
- Begin MSComDlg.CommonDialog LoadDialog
- Left = 2760
- Top = -120
- _version = 65536
- _extentx = 847
- _extenty = 847
- _stockprops = 0
- cancelerror = -1 'True
- dialogtitle = "Load File..."
- filename = "*.APF"
- filter = "ASCII Picture Files (*.APF)"
- End
- Begin VB.Menu mnuFile
- Caption = "&File"
- Begin VB.Menu mnuFileLoad
- Caption = "&Load..."
- Shortcut = ^L
- End
- Begin VB.Menu mnuFileSep
- Caption = "-"
- End
- Begin VB.Menu mnuFileExit
- Caption = "E&xit"
- End
- End
- Attribute VB_Name = "APFForm"
- Attribute VB_Creatable = False
- Attribute VB_Exposed = False
- Option Explicit
- Dim ThePicture As ObjPicture
- Private Sub canvas_Paint()
- If Not ThePicture Is Nothing Then _
- ThePicture.Draw canvas
- End Sub
- Private Sub Form_Load()
- LoadDialog.InitDir = App.Path
- End Sub
- Private Sub Form_Resize()
- canvas.Move 0, 0, ScaleWidth, ScaleHeight
- End Sub
- Private Sub mnuFileExit_Click()
- Unload Me
- End Sub
- Private Sub mnuFileLoad_Click()
- Dim fname As String
- Dim filenum As Integer
- Dim txt As String
- Dim xmin As Single
- Dim ymin As Single
- Dim xmax As Single
- Dim ymax As Single
- ' Allow the user to pick a file.
- On Error Resume Next
- LoadDialog.filename = "*.APF"
- LoadDialog.ShowOpen
- If Err.Number = cdlCancel Then
- Unload LoadDialog
- Exit Sub
- ElseIf Err.Number <> 0 Then
- Unload LoadDialog
- Beep
- MsgBox "Error selecting file.", , vbExclamation
- Exit Sub
- End If
- On Error GoTo 0
- fname = LoadDialog.filename
- LoadDialog.InitDir = Left$(fname, Len(fname) _
- - Len(LoadDialog.FileTitle) - 1)
- ' Clear the pictures.
- canvas.Cls
- Set ThePicture = Nothing
- ' Open the file.
- filenum = FreeFile
- Open fname For Input As #filenum
- ' Make sure it's an Object Picture File.
- Input #filenum, txt
- If txt <> "APF PICTURE" Then
- Close filenum
- Beep
- MsgBox "Error reading file """ & fname & """.", , vbExclamation
- Exit Sub
- End If
- ' Read the picture.
- Set ThePicture = New ObjPicture
- ThePicture.FileInput filenum
- ' Close the file.
- Close filenum
- ' Refresh the display.
- canvas.Refresh
- End Sub
-